package view
{
	import util.ResourceManager;
	import instance.ActivePolicy;
	
	public class KongfuPanda extends AnimatedObject
	{
		private var state:int = 0;//0跑，1,落，2跳，3滚
		
		public function KongfuPanda(activePolicy:Function)
		{
			super(activePolicy);
		}
		
		public function onStageClick():void {
			switch(state) {
				case 0:
				case 1:
					jump();
					state = 2;
					break;
			}
		}
		
		override protected function changeState():void {
			switch(state) {
				case 0:
					break;
				case 1:
					break;
				case 2:
					state = 1;
					flop();
					break;
				default:
					break;
			}
		}
		
		public function run():void {
			changeFrame(ResourceManager.gpandaRun);
			this.activePolicy = ActivePolicy.pandaRun;
			this.playOnce = false;
		}
		
		public function flop():void {
			this.activePolicy = ActivePolicy.pandaFlop;
			this.playOnce = false;
		}
		
		public function jump():void {
			changeFrame(ResourceManager.gpandaJump);
			this.activePolicy = ActivePolicy.pandaJump;
			this.playOnce = true;
		}
	}
}